package com.xkl.springdoc.request;

import com.xkl.springdoc.validate.AddGroup;
import com.xkl.springdoc.validate.EditGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;

/**
 * 用户BO
 *
 * @version: 1.0.0-SNAPSHOT
 * @author: 码农小卡拉
 * @createTime: 2025-09-15 12:44
 **/
@Data
public class UserDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @NotNull(message = "主键不能为空", groups = {EditGroup.class})
    private Long id;
    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空", groups = {AddGroup.class, EditGroup.class})
    private String name;
    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(min = 6, max = 20, message = "密码长度必须在6到20之间", groups = {AddGroup.class, EditGroup.class})
    private String password;
    /**
     * 性别 0-男 1-女
     */
    @Schema(allowableValues = {"0", "1"})
    private Integer sex;
    /**
     * 手机号
     */
    private String phone;
    /**
     * 邮箱
     */
    @Email(message = "邮箱格式错误", groups = {AddGroup.class, EditGroup.class})
    private String email;
}
